<?php

declare(strict_types=1);

/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */

use Hyperf\HttpServer\Router\Router;
use App\Middleware\CorsMiddleware;
use App\Middleware\AuthMiddleware;

//Router::addRoute(['GET', 'POST', 'HEAD'], '/', 'App\Controller\IndexController@index');

//Router::get('/test', function () {
//    return 'Hello World! 123';
//});
//登录进入
Router::addRoute(['GET', 'POST', 'HEAD'], '/entry', 'App\Controller\IndexController@entry', ['middleware' => [CorsMiddleware::class]]);
//游戏初始化信息
Router::addRoute(['GET', 'POST', 'HEAD'], '/init', 'App\Controller\IndexController@init', ['middleware' => [CorsMiddleware::class]]);


// 积分签到
Router::addGroup('/sign', function () {
    Router::get('/doSign', 'App\Controller\SignController@doSign'); // 签到
    Router::get('/signList', 'App\Controller\SignController@signList'); // 签到列表
    Router::post('/signAdd', 'App\Controller\SignController@signAdd'); // 累计签到
    Router::get('/index', 'App\Controller\SignController@index'); // 累计签到

}, ['middleware' => [CorsMiddleware::class, AuthMiddleware::class]]);

// 排行榜
Router::addGroup('/rank', function () {
    Router::get('/list', 'App\Controller\RankController@rankingList'); // 排行榜

}, ['middleware' => [CorsMiddleware::class, AuthMiddleware::class]]);

// 分享复活
Router::addGroup('/share', function () {
    Router::post('/rebirth', 'App\Controller\ShareController@rebirth'); // 分享复活
}, ['middleware' => [CorsMiddleware::class, AuthMiddleware::class]]);


// 大奖赛http数据
Router::addGroup('/djs', function () {
    Router::get('/hall', 'App\Controller\GrandMatchController@hall'); // 大厅奖励和胜局数据
    Router::get('/hot', 'App\Controller\GrandMatchController@hot'); // 跑马灯数据
    Router::post('/times', 'App\Controller\GrandMatchController@playTimes'); // 获取当日玩家数据
    Router::post('/draw', 'App\Controller\GrandMatchController@draw'); //领奖
    Router::post('/rank', 'App\Controller\GrandMatchController@rank'); //排行榜
    Router::post('/terminal', 'App\Controller\GrandMatchController@terminal'); //手动结束
}, ['middleware' => [CorsMiddleware::class, AuthMiddleware::class]]);

Router::addServer('ws', function () {
    Router::get('/', 'App\Controller\WebSocketController');
});